﻿Imports PadovadoAPI
Imports System.Data

Partial Class WebUserControls_Anagrafica
    Inherits System.Web.UI.UserControl

    Public Function InsertAnagrafica() As Integer
        Dim sql As String = ""
        Dim dbo As New DBObject
        Dim PK_Anagrafica As Integer
        sql = "INSERT INTO Anagrafica VALUES ('" & TBDenominazione.Text & "', '" & TBReferente.Text & "', '" & TBTelefono.Text & "', '" & TBFax.Text & _
                   "', '" & TBMail.Text & "', 0)"
        dbo.ExecuteNonQuery(sql, Nothing, CommandType.Text)
        sql = "SELECT MAX(PK_Anagrafica) FROM Anagrafica"
        PK_Anagrafica = dbo.ExecuteScalar(sql, Nothing, CommandType.Text)

        Return PK_Anagrafica
    End Function

    Public Property Denominazione As String
        Set(value As String)
            TBDenominazione.Text = value

        End Set
        Get
            Return TBDenominazione.Text

        End Get
    End Property

    Public Property Fax As String
        Set(value As String)
            TBFax.Text = value

        End Set
        Get
            Return TBFax.Text

        End Get
    End Property


    Public Property Mail As String
        Set(value As String)
            TBMail.Text = value

        End Set
        Get
            Return TBMail.Text

        End Get
    End Property

    Public Property Referente As String
        Set(value As String)
            TBReferente.Text = value

        End Set
        Get
            Return TBReferente.Text

        End Get
    End Property

    Public Property Telefono As String
        Set(value As String)
            TBTelefono.Text = value

        End Set
        Get
            Return TBTelefono.Text

        End Get
    End Property

End Class
